#include <stack>
class MyQueue {
private:
    std::stack<int>stacks[2];
public:
    /** Initialize your data structure here. */
    MyQueue() {

    }

    /** Push element x to the back of queue. */
    void push(int x) {
        stacks[0].push(x);
    }

    /** Removes the element from in front of queue and returns that element. */
    int pop() {
        if (stacks[1].empty()) {
            while (!stacks[0].empty()) {
                stacks[1].push(stacks[0].top());
                stacks[0].pop();
            }
        }
        int res = stacks[1].top();
        stacks[1].pop();
        return res;
    }

    /** Get the front element. */
    int peek() {
        if (stacks[1].empty()) {
            while (!stacks[0].empty()) {
                stacks[1].push(stacks[0].top());
                stacks[0].pop();
            }
        }
        int res = stacks[1].top();
        return res;
    }

    /** Returns whether the queue is empty. */
    bool empty() {
        return stacks[0].empty() && stacks[1].empty();
    }
};

/**
 * Your MyQueue object will be instantiated and called as such:
 * MyQueue* obj = new MyQueue();
 * obj->push(x);
 * int param_2 = obj->pop();
 * int param_3 = obj->peek();
 * bool param_4 = obj->empty();
 */